	/** MASCARA TELEFONE **/
	function maskPhone(id) {
		$(id).keyup(function (){
				elementObject= $(this).val().replace(/\D/g,"");		
				if(elementObject.length > 10) {
					elementObject=elementObject.replace(/^(\d\d)(\d)/g,"($1)$2");
					elementObject=elementObject.replace(/(\d{5})(\d)/,"$1-$2");
				} else {
					elementObject=elementObject.replace(/^(\d\d)(\d)/g,"($1)$2");
					elementObject=elementObject.replace(/(\d{4})(\d)/,"$1-$2");
				}
				if(elementObject.length > 14) {
					elementObject= elementObject.substr(0,14);
				}
				if(elementObject.length < 13) {
					$(id).attr('style', 'color: red !important');
				} else {
					$(id).removeAttr('style');
				}
				$(this).val(elementObject);
			});
	}
	/** MASCARA DATE **/
	function maskDate(id) {
		$(id).keyup(function (){
				elementObject= $(this).val().replace(/\D/g,"");
				if(elementObject.length > 2) {
					elementObject=elementObject.replace(/(\d{2})(\d)/ ,"$1/$2");
					if(elementObject.length > 4) {
						elementObject=elementObject.replace(/(\d{2})(\d)/ ,"$1/$2");
					}
				}
				if(elementObject.length > 10) {
					elementObject= elementObject.substr(0,10);
				}
				if(elementObject.length < 10) {
					$(id).attr('style', 'color: red !important');
				} else {
					$(id).removeAttr('style');
				}
				$(this).val(elementObject);
			});
	}
	/** MASCARA CEP **/
	function maskCep(id) {
		$(id).keyup(function (){
				elementObject= $(this).val().replace(/\D/g,"");		
				if(elementObject.length > 5) {
					elementObject=elementObject.replace(/(\d{5})(\d)/,"$1-$2");
				}
				$(this).val(elementObject);
			});
	}
	/** MASCARA CPF **/
	function maskCpf(id) {
		$(id).keyup(function (){
				elementObject= $(this).val().replace(/\D/g,"");		
				if(elementObject.length > 3) {
					elementObject=elementObject.replace(/(\d{3})(\d)/,"$1.$2");
					if(elementObject.length > 6) {
						elementObject=elementObject.replace(/(\d{3})(\d)/,"$1.$2");
						if(elementObject.length > 9) {
							elementObject=elementObject.replace(/(\d{3})(\d)/,"$1-$2");
						}
					}
				}
				if(elementObject.length > 13) {
					elementObject= elementObject.substr(0,14);
				}
				if(elementObject.length < 14) {
					$(id).attr('style', 'color: red !important');
				} else {
					$(id).removeAttr('style');
				}
				$(this).val(elementObject);
			});
	}

	/** MASCARA RG **/
	function maskRg(id) {
		$(id).keyup(function (){
				elementObject= $(this).val().replace(/\D/g,"");		
				if(elementObject.length > 3) {
					elementObject=elementObject.replace(/(\d{2})(\d)/,"$1.$2");
					if(elementObject.length > 6) {
						elementObject=elementObject.replace(/(\d{3})(\d)/,"$1.$2");
						if(elementObject.length > 9) {
							elementObject=elementObject.replace(/(\d{3})(\d)/,"$1-$2");
						}
					}
				}
				if(elementObject.length > 11) {
					elementObject= elementObject.substr(0,12);
				}
				if(elementObject.length < 12) {
					$(id).attr('style', 'color: red !important');
				} else {
					$(id).removeAttr('style');
				}
				$(this).val(elementObject);
			});
	}